3 Lecture
CS201
Midterm & Final Term Short Notes
First C program
The first C program is often a simple "Hello, World!" program, which is a basic program that outputs the text "Hello, World!" to the console or terminal. This program is used as an introductory example to demonstrate the basic structure of a C p
Important Mcq's
Midterm & Finalterm Prepration
Past papers included
Download PDF
- What is the purpose of the "Hello, World!" program? A. To introduce the basics of C programming B. To display "Hello, World!" on the screen C. Both A and B
Answer: C
- Which function is used to display text on the screen in a C program? A. print B. println C. printf
Answer: C
- What is the syntax for writing a "Hello, World!" program in C? A. print("Hello, World!") B. printf("Hello, World!"); C. println("Hello, World!");
Answer: B
- Which keyword is used to indicate the beginning of the main function in a C program? A. function B. main C. start
Answer: B
- Which symbol is used to end a statement in a C program? A. ; B. : C. ,
Answer: A
- Which header file must be included to use printf() function in a C program? A. <stdio.h> B. <stdlib.h> C. <string.h>
Answer: A
- Which type of brackets are used to enclose the main function in a C program? A. () B. {} C. []
Answer: B
- Which operator is used to assign a value to a variable in C? A. = B. == C. :
Answer: A
- Which data type is used to store whole numbers in C? A. float B. char C. int
Answer: C
- What is the output of the "Hello, World!" program? A. Hello, World! B. World, Hello! C. Hello!
Answer: A
Subjective Short Notes
Midterm & Finalterm Prepration
Past papers included
Download PDF
What is the significance of the "Hello, World!" program in C programming? Answer: The "Hello, World!" program is often used as an introduction to the basics of C programming, and it is considered a starting point for beginners to learn about the syntax and structure of a C program.
What is the purpose of including the stdio.h header file in a C program? Answer: The stdio.h header file is necessary for using input/output functions in a C program, such as the printf() function, which is used to display text on the screen.
What is the purpose of the main() function in a C program? Answer: The main() function is the entry point of a C program, and it contains the code that is executed when the program is run.
How is a variable declared in a C program? Answer: A variable is declared by specifying its data type and name, such as int x; for declaring an integer variable named x.
What is the syntax for displaying the value of a variable in a C program? Answer: The printf() function is used to display the value of a variable, and the variable name is enclosed in the % symbol followed by its data type, such as %d for an integer variable.
What is the purpose of the return statement in the main() function? Answer: The return statement is used to indicate the exit status of a program, and it returns a value to the operating system.
What is the purpose of the escape sequence \n in a C program? Answer: The escape sequence \n is used to insert a new line character in a string, which is used for formatting the output in a C program.
What is the purpose of the semicolon (;) in a C program? Answer: The semicolon (;) is used to indicate the end of a statement in a C program.
How is a comment added to a C program? Answer: A comment is added to a C program using the /* */ symbols to enclose the text, or by using // to indicate a single line comment.
What is the purpose of the #include directive in a C program? Answer: The #include directive is used to include header files in a C program, which contain predefined functions and variables used in the program.